#include "StdAfx.h"
#include "VoiceCardMapper.h"
namespace DBLayer {


CVoiceCardMapper::~CVoiceCardMapper(void)
{
}

	std::vector<HAL::CVoiceCardEntry*>* CVoiceCardMapper::GetAll()
	{
		if(m_DBType == DBTYPE_MYSQL)
		{
			sql::ResultSet * rs = executeSql(selectStr);
			if(rs == NULL)
				return NULL;

			std::vector<HAL::CVoiceCardEntry*>* cards = new std::vector<HAL::CVoiceCardEntry*>();
			while(rs->next())
			{
				HAL::CVoiceCardEntry* card = new HAL::CVoiceCardEntry();
				card->CardID = rs->getInt("cardid");
				card->CardName = rs->getString("cardName");
				card->CardSN = rs->getString("cardsn");
				cards->push_back(card);
			}
			return cards;
		}
		return NULL;
	}
}